import request from '@/utils/request'

export interface attrInfoModel {
    attrName: string,
    attrValueList: attrValueModel[],
    categoryId: number,
    categoryLevel: number,
    id?: number,
    attrIdValId?: string
}

export interface attrValueModel {
    attrId?: number,
    id?: number,
    valueName: string,
    inputVisible?:boolean
}

export default {
    getAttrInfo(category1Id: number, category2Id: number, category3Id: number) {
        return request.get<any, attrInfoModel[]>(`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`)
    },
    saveAttrInfo(attrForm: attrInfoModel) {
        return request.post<any, null>('/admin/product/saveAttrInfo',attrForm)
    },
    deleteAttr(attrId: number) {
        return request.delete<any, null>(`/admin/product/deleteAttr/${attrId}`)
    }
}